package sort;

import java.util.Comparator;
import java.util.PriorityQueue;

public class Priority {
    public static void main(String[] args) {
        int [] arr = {3, 2, 1, 5, 4};
        PriorityQueue<Integer> pq = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        for (int i = 0; i < arr.length; i++) {
            pq.add(arr[i]);
        }
        while (!pq.isEmpty()) {
            System.out.println(pq.poll());
        }
    }
}
